﻿<Window x:Class="LedgerLeasedWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="LedgerLeasedWindow" Width="auto"  Icon="../../images/Main/keys.png"
        xmlns:wpftoolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">
    <Window.Resources>
        <!--ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Themes/DataGrid.Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>            
        </ResourceDictionary-->
        <Style x:Key="tb_ElementStyleRight" TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Right" />
        </Style>

    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Expander Width="Auto" ExpandDirection="Right" HorizontalAlignment="Right" Grid.Column="0">
            <Expander.Header>
                <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="Auto" Name="ExpanderText">
            <TextBlock.LayoutTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                    <SkewTransform AngleX="0" AngleY="0"/>
                    <RotateTransform Angle="90"/>
                    <TranslateTransform X="0" Y="0"/>
                </TransformGroup>
            </TextBlock.LayoutTransform>
            <TextBlock.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                    <SkewTransform AngleX="0" AngleY="0"/>
                    <RotateTransform Angle="0"/>
                    <TranslateTransform X="0" Y="0"/>
                </TransformGroup>
            </TextBlock.RenderTransform>
                </TextBlock>
            </Expander.Header>

            <Border Name="borderHeader" BorderBrush="Gray" 
                BorderThickness="1,1,1,1" 
                                    CornerRadius="6,6,6,6">
                <Grid Name="gridListbox"  VerticalAlignment="Stretch" Height="auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" 
                            Background="Aquamarine"                            
                            VerticalAlignment="Top"
                            Margin="2" Grid.Row="0">
                        <TextBox MinHeight="10" 
                             MinWidth="126"
                             Margin="2"
                             Name="searchBox"
                             HorizontalAlignment="Stretch"></TextBox>
                        <Button MinWidth="50"                            
                            Margin="2"
                            Name="searchButton">Find</Button>
                    </StackPanel>
                    <TreeView Name="tvInventory"
                          Grid.Row="1"
                          HorizontalContentAlignment="Stretch"  
                          ItemsSource="{Binding}"
                          VerticalAlignment="Top"
                          Height="auto">
                    </TreeView>
                </Grid>
            </Border>
        </Expander>
        <Border Name="borderHeader1" 
                Grid.Column="1" 
                BorderBrush="Gray" 
                BorderThickness="0,1,1,1" 
                CornerRadius="6,6,6,6">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                </Grid.RowDefinitions>
                <Border Name="borderHeadera" 
                    Grid.Row="0"
                    BorderBrush="Gray" 
                    BorderThickness="0,1,1,1" 
                    CornerRadius="6,6,6,6">
                    <wpftoolkit:DataGrid  x:Name="myDatagrid"                                              
                                              SelectionMode="Extended"                                               
                                              AreRowDetailsFrozen="False" 
                                              EnableRowVirtualization="True" 
                                              AutoGenerateColumns="False"
                                              EnableColumnVirtualization="True"
                                              VirtualizingStackPanel.IsVirtualizing ="False" 
                                              VirtualizingStackPanel.VirtualizationMode="Recycling"
                                              HorizontalScrollBarVisibility="Auto"
                                              VerticalScrollBarVisibility="Auto"                                              
                                              CanUserReorderColumns="True" 
                                              CanUserResizeColumns="False" 
                                              CanUserResizeRows="False" 
                                              CanUserSortColumns="False">
                        <wpftoolkit:DataGrid.RowBackground>
                            <LinearGradientBrush EndPoint="-0.136,-0.163" StartPoint="1.291,1.248">
                                <GradientStop Color="AliceBlue" Offset="0.004"/>
                                <GradientStop Color="#FFF7F7ED" Offset="0.991"/>
                            </LinearGradientBrush>
                        </wpftoolkit:DataGrid.RowBackground>
                        <wpftoolkit:DataGrid.AlternatingRowBackground>
                            <LinearGradientBrush EndPoint="-0.136,-0.163" StartPoint="1.291,1.248">
                                <GradientStop Color="#FF9B9999" Offset="0.013"/>
                                <GradientStop Color="#FFFFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </wpftoolkit:DataGrid.AlternatingRowBackground>
                        <wpftoolkit:DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
                                    <StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Lease Details" FontWeight="Bold" Margin="0 10 10 0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Begin:" FontWeight="Bold" Margin="0 10 10 0"/>
                                            <TextBlock Text="{Binding leaseDetails.LeaseBegin, StringFormat='d'}" Margin="0 10 10 0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="End:" FontWeight="Bold" Margin="0 0 10 0"/>
                                            <TextBlock Text="{Binding leaseDetails.LeaseEnd, StringFormat='d'}" Margin="0 0 10 0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Description:" FontWeight="Bold" Margin="0 0 10 0"/>
                                            <TextBlock Text="{Binding leaseDetails.LeaseDescription}" Margin="0 0 10 0"/>
                                        </StackPanel>
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </wpftoolkit:DataGrid.RowDetailsTemplate>
                        <wpftoolkit:DataGrid.Columns>
                            <wpftoolkit:DataGridTextColumn Header="Asset No" Binding="{Binding  main.Assetno}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Scan Date" Binding="{Binding main.LastScanDate, StringFormat='d'}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Category Code" Binding="{Binding  main.CategoryCode}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Location" Binding="{Binding  locationDetails.LocationName}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Department" Binding="{Binding  departmentDetails.DepartmentName}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Section" Binding="{Binding  main.Section}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Invoice/PO#" Binding="{Binding  main.InvoiceNumber}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Date Purchased" Binding="{Binding main.DateAcquired, StringFormat='d'}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Bought From" Binding="{Binding  main.BoughtFrom}" Width="Auto" IsReadOnly="True"/>
                            <wpftoolkit:DataGridTextColumn Header="Base Cost" Binding="{Binding  main.BaseCost, StringFormat=\{0:C\}}" Width="Auto" IsReadOnly="True" ElementStyle="{StaticResource tb_ElementStyleRight}"/>
                            <wpftoolkit:DataGridTextColumn Header="VAT" Binding="{Binding  main.VAT, StringFormat=\{0:C\}}" Width="Auto" IsReadOnly="True" ElementStyle="{StaticResource tb_ElementStyleRight}"/>
                            <wpftoolkit:DataGridTextColumn Header="Total Cost" Binding="{Binding  assetCost, StringFormat=\{0:C\}}" Width="Auto" IsReadOnly="True" ElementStyle="{StaticResource tb_ElementStyleRight}"/>
                            <wpftoolkit:DataGridTextColumn Header="Manufacturer" Binding="{Binding  main.Manufacturer}" Width="Auto" IsReadOnly="True" />
                            <wpftoolkit:DataGridTextColumn Header="Brand Name" Binding="{Binding  main.BrandName}" Width="Auto" IsReadOnly="True" />
                            <wpftoolkit:DataGridTextColumn Header="Model No" Binding="{Binding  main.ModelNumber}" Width="Auto" IsReadOnly="True" />
                            <wpftoolkit:DataGridTextColumn Header="Salvage Value" Binding="{Binding  main.SalvageValue, StringFormat=\{0:C\}}" Width="Auto" IsReadOnly="True" ElementStyle="{StaticResource tb_ElementStyleRight}"/>
                            <wpftoolkit:DataGridTextColumn Header="Replacement Cost" Binding="{Binding  main.ReplacementCost, StringFormat=\{0:C\}}" Width="Auto" IsReadOnly="True" ElementStyle="{StaticResource tb_ElementStyleRight}"/>
                            <wpftoolkit:DataGridTextColumn Header="Condition" Binding="{Binding  main.Condition}" Width="Auto" IsReadOnly="True" />
                            <wpftoolkit:DataGridTextColumn Header="Status" Binding="{Binding  main.Status}" Width="Auto" IsReadOnly="True" />
                            <wpftoolkit:DataGridTextColumn Header="Serial No" Binding="{Binding  main.SerialNumber}" Width="Auto" IsReadOnly="True" />
                        </wpftoolkit:DataGrid.Columns>
                    </wpftoolkit:DataGrid>
                </Border>
                <Border Name="borderHeader2" 
                    Grid.Row="1"
                    BorderBrush="Gray" 
                    BorderThickness="0,1,1,1" 
                    CornerRadius="6,6,6,6">
                    <StackPanel Orientation="Horizontal" 
                            Background="White"                            
                            VerticalAlignment="Top"
                            Margin="2">
                        <GroupBox Header="Acquisition Cost"
                                  Margin="5"
                                  Foreground="Red">
                            <TextBox Name="textboxAcquisitionCost"
                                     Width="150"
                                     TextAlignment="Right"
                                     FontWeight="bold">0.00</TextBox>
                        </GroupBox>
                        <GroupBox Header="Accumulated Depreciation"
                                  Margin="5"
                                  Foreground="Red">
                            <TextBox Name="textboxAccumulatedDepreciation"
                                     Width="150"
                                     TextAlignment="Right"                                     
                                     FontWeight="bold">0.00</TextBox>
                        </GroupBox>
                        <GroupBox Header="Net Book Value"
                                  Margin="5"
                                  Foreground="Red">
                            <TextBox Name="textboxNetBookValue"
                                     Width="150"
                                     TextAlignment="Right"
                                     FontWeight="bold">0.00</TextBox>
                        </GroupBox>
                    </StackPanel>
                </Border>
            </Grid>
        </Border>
    </Grid>
</Window>
